#include <stdio.h>

int main()
{
    char input[100], output[350];
    while (fgets(input, sizeof(input), stdin))
    {
        char *s = input, *p = output;
        if (input[0] == '#' && (input[1] < 32))
            break;
        for (; *s >= 32; s++)
        {
#define ESCAPE(str) *p++ = str[0]; *p++ = str[1]; *p++ = str[2];
            switch (*s)
            {
            case ' ': ESCAPE("%20"); break;
            case '!': ESCAPE("%21"); break;
            case '$': ESCAPE("%24"); break;
            case '%': ESCAPE("%25"); break;
            case '(': ESCAPE("%28"); break;
            case ')': ESCAPE("%29"); break;
            case '*': ESCAPE("%2a"); break;
            default:  *p++ = *s; break;
            };
        }
        *p = 0;
        printf("%s\n", output);
    }
    return 0;
}